import request from '@/utils/request'
// import axios from 'axios'
// 组织架构数据列表
// let fn = () => {}
export const companyDepartment = () => {
  // 这里是下一次请求前取消上一次请求取消
  // fn()
  return request({
    url: '/company/department'
    // 产生取消该请求的方法
    // cancelToken: new axios.CancelToken((cancelFn) => {
    //   fn = cancelFn
    //   // console.log('cancelFn', cancelFn)
    // })
  })
}
// 员工列表
export const sysUserSimple = () => {
  return request({
    url: '/sys/user/simple'
  })
}
// 新增组织架构接口
// 增:post     删:delete     改: 全量put   部分：patch     查:get
export const companyDepartmentPost = (data) => {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

// 删除组织架构api
export const companyDepartmentDelete = (id) => {
  return request({
    url: '/company/department/' + id,
    method: 'delete'
  })
}
// 修改组织架构
export const companyDepartmentPut = (data) => {
  return request({
    url: '/company/department/' + data.id,
    method: 'put',
    data
  })
}
